<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/layout_admin.jsp">
    <s:layout-component name="content">
        <br/>
        <s:useActionBean beanclass="cz.muni.fi.pa165.travelagency.web.PackageTourActionBean" var="actionBean"/>
        <h3><f:message key="ptour.all" /></h3>
        <c:if test="${fn:length(actionBean.ptours) > 0}">
            <table>
                <tr>
                    <th><f:message key="ptour.id"/></th>
                    <th><f:message key="ptour.name"/></th>
                    <th><f:message key="ptour.destination"/></th>
                    <th><f:message key="ptour.pricePerPerson"/></th>
                    <th><f:message key="ptour.start"/></th>
                    <th><f:message key="ptour.end"/></th>
                    <th><f:message key="ptour.capacity"/></th>
                    <th><f:message key="ptour.description"/></th>
                    <th colspan="3"></th>
                </tr>
                <c:forEach items="${actionBean.ptours}" var="ptour">
                    <tr>
                        <td>${ptour.id}</td>
                        <td><c:out value="${ptour.name}"/></td>
                        <td><c:out value="${ptour.destination}"/></td>
                        <td><c:out value="${ptour.pricePerPerson}"/></td>
                        <td><f:formatDate value="${ptour.start}" pattern="dd.MM.yyyy"/></td>
                        <td><f:formatDate value="${ptour.end}" pattern="dd.MM.yyyy"/></td>
                        <td><c:out value="${ptour.capacity}"/></td>
                        <td><c:out value="${ptour.description}"/></td>
                        <td><s:link beanclass="cz.muni.fi.pa165.travelagency.web.PackageTourActionBean" event="availableTours"><s:param name="ptour.id" value="${ptour.id}"/><f:message key="tour.tours"/></s:link> </td>
                        <td><s:link beanclass="cz.muni.fi.pa165.travelagency.web.PackageTourActionBean" event="delete"><s:param name="ptour.id" value="${ptour.id}"/><f:message key="ptour.action.delete" /></s:link> </td>
                        <td><s:link beanclass="cz.muni.fi.pa165.travelagency.web.PackageTourActionBean" event="edit"><s:param name="ptour.id" value="${ptour.id}"/><f:message key="ptour.action.update" /></s:link> </td>
                    </tr>
                </c:forEach>
            </table>
            <br><br>
        </c:if>
        <c:if test="${fn:length(actionBean.ptours) == 0}">
            <p><f:message key="ptour.none" /></p><br>
        </c:if>
        <s:form beanclass="cz.muni.fi.pa165.travelagency.web.PackageTourActionBean">
            <fieldset><legend><f:message key="ptour.show.legend" /></legend>
                <%@include file="ptour_form.jsp"%>
                <s:submit name="add"><f:message key="ptour.action.new" /></s:submit>
                </fieldset>
        </s:form>
    </s:layout-component>
</s:layout-render>